//: Playground - noun: a place where people can play

import UIKit

//NotificationCenter.default.post(name: Notification.Name("SocketConnectFailure"), object: ["errorCode":000]);
//
//NotificationCenter.default.addObserver(self, selector: #selector(SocketConnectFailure(notification:)), name:  Notification.Name("SocketConnectFailure"), object: nil)

extension Notification.Name {
    /// 使用命名空间的方式
    public struct SocketTask {
        public static let connectFailure = Notification.Name(rawValue: "SocketConnectFailure")
        public static let connectSuccess = Notification.Name(rawValue: "SocketConnectSuccess")
    }
}

////   想通知中心post 消息
//NotificationCenter.default.post(name: Notification.Name.SocketTask.connectFailure, object: ["errorCode":000])
////   增加观察者
//NotificationCenter.default.addObserver(self, selector: #selector(SocketConnectFailure(notification:)), name: Notification.Name.SocketTask.connectFailure, object: nil)
